<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>The D2RQ Mapping Language | The D2RQ Platform</title>
    <link rel="stylesheet" type="text/css" href="style.css" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script src="script.js"></script>
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-30091096-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
  </head>
  <body>
    <header>
      <div class="document-collection">This document is part of the <a href="/">D2RQ documentation</a>.</div>
      <h1>The D2RQ Mapping Language</h1>
      <dl>
        <dt>Version:</dt>
        <dd>v0.8 – 2012-03-12</dd>
        <dt>Authors:</dt>
        <dd><a href="http://richard.cyganiak.de/">Richard Cyganiak</a> (DERI, NUI Galway, Ireland)</dd>
        <dd><a href="http://www.wiwiss.fu-berlin.de/en/institute/pwo/bizer/team/BizerChristian.html">Chris Bizer</a> (Freie Universit&auml;t Berlin, Germany)</dd>
        <dd>J&ouml;rg Garbers (Freie Universit&auml;t Berlin, Germany)</dd>
        <dd><a href="http://www.oliver-maresch.de/">Oliver Maresch</a> (Technische Universit&auml;t Berlin, Germany)</dd>
        <dd><a href="http://beckr.org/">Christian Becker</a> (Freie Universit&auml;t Berlin, Germany)</dd>
        <dt>Abstract:</dt>
        <dd>This document describes the <strong>D2RQ Mapping Language</strong>,
          a declarative language for mapping relational database schemas to
          RDF vocabularies and OWL ontologies. The language is implemented in
          the <a href="/">D2RQ Platform</a>.</dd>
      </dl>
    </header>

<ul class="toc">
  <li>1. <a href="#introduction">Introduction</a></li>
  <li>2. <a href="#examples">Example D2RQ mappings</a></li>
  <li>3. <a href="#database">Database connection (<code>d2rq:Database</code>)</a>
    <ul>
      <li>3.1 <a href="#database-properties">Properties of <code>d2rq:Database</code></a></li>
      <li>3.2 <a href="#example-database">Example: Connecting to a MySQL database</a></li>
      <li>3.3 <a href="#jdbc-connection-properties">Specifying JDBC connection properties</a></li>
      <li>3.4 <a href="#keep-alive">Keep-alive long-term connections</a></li>
    </ul>
  </li>
  <li>4. <a href="#configuration">Global configuration of the mapping engine (<code>d2rq:Configuration</code>)</a>
    <ul>
      <li>4.1 <a href="#configuration-properties">Properties of <code>d2rq:Configuration</code></a></li>
      <li>4.2 <a href="#example-optimization">Example: Activating optimizations</a></li>
    </ul>
  </li>
  <li>5. <a href="#classmap">Creating RDF resources (<code>d2rq:ClassMap</code>)</a>
    <ul>
      <li>5.1 <a href="#resource-identity">Resource Identity</a></li>
      <li>5.2 <a href="#class-map-properties">Properties of <code>d2rq:ClassMap</code></a></li>
      <li>5.3 <a href="#example-uri-pattern">Example: Identifying class map instances with a URI pattern</a></li>
      <li>5.4 <a href="#example-blank-nodes">Example: Class map instances with blank nodes</a></li>
      <li>5.5 <a href="#example-dynamic-type">Example: A group of classes all mapped from the same table</a></li>
    </ul>
  </li>
  <li>6. <a href="#propertybridge">Adding properties to resources (<code>d2rq:PropertyBridge</code>)</a>
    <ul>
      <li>6.1 <a href="#property-bridge-properties">Properties of <code>d2rq:PropertyBridge</code></a></li>
      <li>6.2 <a href="#example-property-bridge">Example: A simple property bridge</a></li>
      <li>6.3 <a href="#example-join">Example: Property bridge using information from another table</a></li>
      <li>6.4 <a href="#example-mailto">Example: A property bridge with <code>mailto:</code> URIs</a></li>
      <li>6.5 <a href="#example-sqlexpression">Example: A property bridge that computes mailbox hashes</a></li>
      <li>6.6 <a href="#example-uri-sql-expression">Example: A property bridge with URIs generated by an SQL expression</a></li>
      <li>6.7 <a href="#example-refers">Example: Linking instances from two database tables</a></li>
      <li>6.8 <a href="#example-multicolumn-fk">Example: Foreign key with multiple columns</a></li>
      <li>6.9 <a href="#example-alias">Example: Joining a table to itself using <code>d2rq:alias</code></a></li>
      <li>6.10 <a href="#example-constant">Example: Adding a constant property-value pair to each instance of a class map</a></li>
    </ul>
  </li>
  <li>7. <a href="#translationtable">Translating values (<code>d2rq:TranslationTable</code>)</a>
    <ul>
      <li>7.1 <a href="#translation-table-properties">Properties of <code>d2rq:TranslationTable</code></a></li>
      <li>7.2 <a href="#translation">Translation</a></li>
      <li>7.3 <a href="#example-translation">Example: Translating color codes</a></li>
    </ul>
  </li>
  <li>8. <a href="#download-map">Enabling HTTP access to CLOBs/BLOBs (<code>d2rq:DownloadMap</code>)</a>
    <ul>
      <li>8.1 <a href="#download-map-properties">Properties of <code>d2rq:DownloadMap</code></a></li>
      <li>8.2 <a href="#example-download-map">Example: Making PDFs downloadable</a></li>
      <li>8.3 <a href="#example-combined-download-map">Example: Download map combined with a property bridge</a></li>
      <li>8.4 <a href="#example-multiple-download-formats">Example: Downloads in multiple formats</a></li>
      <li>8.5 <a href="#example-dynamic-mediatype">Example: Media type from a database column</a></li>
    </ul>
  </li>
  <li>9. <a href="#servingvocabularies">Serving Vocabulary Classes and Properties</a>
    <ul>
      <li>9.1 <a href="#vocab-label-comment">Labels and Comments for Vocabulary Terms</a></li>
      <li>9.2 <a href="#additionalproperty">AdditionalProperty</a></li>
      <li>9.3 <a href="#example-equivalent-class">Example: Providing an additional property for a class definition</a></li>
      <li>9.4 <a href="#example-equivalent-property">Example: Providing an additional property for a property definition</a></li>
      <li>9.5 <a href="#vocabulary-serving">Controlling vocabulary serving</a></li>
    </ul>
  </li>
  <li>10. <a href="#conditional">Conditional Mappings</a>
    <ul>
      <li>10.1 <a href="#example-condition">Example: Using <code>d2rq:condition</code> on a <code>d2rq:ClassMap</code></a></li>
      <li>10.2 <a href="#example-zerolength">Example: Filtering zero-length strings</a></li>
      <li>10.3 <a href="#example-typecodes">Example: Relationship type codes</a></li>
    </ul>
  </li>
  <li>11. <a href="#hint">Performance Optimization using Hint Properties</a>
    <ul>
      <li>11.1 <a href="#example-maxlength">Example: Providing a maximum length</a></li>
      <li>11.2 <a href="#example-value-regex">Example: Providing a regular expression</a></li>
    </ul>
  </li>
  <li>12. <a href="#deprecated">Deprecated Language Constructs</a>
    <ul>
      <li>12.1 <a href="#datatype-object"><code>d2rq:DatatypePropertyBridge</code> and <code>d2rq:ObjectPropertyBridge</code></a></li>
      <li>12.2 <a href="#additionalproperty_deprecated"><code>d2rq:additionalProperty</code></a></li>
      <li>12.3 <a href="#deprecated-class-map-property-bridge"><code>d2rq:classMap</code> and <code>d2rq:propertyBridge</code> properties</a></li>
      <li>12.4 <a href="#deprecated-odbc-dsn"><code>d2rq:odbcDSN</code> and <code>d2rq:allowDistinct</code></a></li>
    </ul>
  </li>
</ul>


<h2 id="introduction">1. Introduction</h2>

<p>The <strong>D2RQ Mapping Language</strong> is a declarative
language for describing the relation between 
a relational database schema and
<a href="http://www.w3.org/TR/rdf-schema/">RDFS vocabularies</a> or
<a href="http://www.w3.org/TR/owl2-primer/">OWL</a> ontologies.</p>

<p>A <strong>D2RQ mapping</strong> is itself an RDF document written in
<a href="http://www.w3.org/TR/turtle/">Turtle</a> syntax.
The mapping is expressed using terms in the <strong>D2RQ namespace</strong>:

<pre>http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#</pre>

<p>The terms in this namespace are formally defined in the
<a href="terms/d2rq">D2RQ RDF schema</a>
(<a href="terms/d2rq.ttl">Turtle version</a>,
<a href="terms/d2rq.rdf">RDF/XML version</a>).</p>

<p>The mapping defines a <strong>virtual RDF graph</strong> that contains
information from the database. This is similar to the concept of views
in SQL, except that the virtual data structure is an RDF graph instead of
a virtual relational table. The virtual RDF graph can be accessed in
various ways, depending on what's offered by the implementation.
The <a href="/">D2RQ Platform</a> provides SPARQL access,
a Linked Data server, an RDF dump generator, a simple HTML interface,
and Jena API access to D2RQ-mapped databases.</p>

<p>D2RQ mappings can be written by hand in a text editor, but usually
it is much faster to start with the
<a href="generate-mapping">generate-mapping tool</a> that generates a
skeleton “<strong>default mapping</strong>” from the database schema.</p>

<p>The figure below shows the <strong>structure of an example D2RQ map</strong>:</p>
<p><img src="images/mapping.png" alt="Diagram: Structure of a typical D2RQ map" /></p>

<p>The database is mapped to RDF terms, shown on the right, using
<code>d2rq:ClassMap</code>s and <code>d2rq:PropertyBridge</code>s.
The most important objects within the mapping are the class maps.
A class map represents a class or a group of similar classes of the ontology.
A class map specifies how URIs (or blank nodes) are generated for
the instances of the class. It has a set of property bridges,
which specify how the properties of an instance are created.</p>


<h2 id="examples">2. Example D2RQ mappings</h2>

<p><strong>ISWC example:</strong> We are using an example database which stores information about conferences, 
  papers, authors and topics throughout this manual. The database is mapped to the 
  International Semantic Web Community (ISWC) Ontology.</p>
<ul>
  <li>ISWC D2RQ mapping file: <a href="example/mapping-iswc.ttl">mapping-iswc.ttl</a></li>
  <li>Example database (with some entries from the ISWC 2002 conference):
    <a href="example/iswc-mysql.sql">iswc-mysql.sql</a> (MySQL dump)</li>
  <li>ISWC ontology: <a href="example/iswc.daml">iswc.daml</a></li>
</ul>

<p><strong>Wordpress example:</strong> Another example maps the
<a href="http://wordpress.org/">Wordpress</a> database schema
to RDF.</p>
<ul>
  <li>Wordpress mapping file: <a href="example/wordpress.ttl">wordpress.ttl</a></li>
</ul>

<p><strong>Template:</strong>
The following example D2RQ map relates the table conferences in a database to the class 
conference in an ontology. You can use the map as a template for writing your own 
maps.</p>

<pre>
# D2RQ Namespace  
@prefix d2rq:        &lt;http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#&gt; .
# Namespace of the ontology
@prefix : &lt;http://annotation.semanticweb.org/iswc/iswc.daml#&gt; .

# Namespace of the mapping file; does not appear in mapped data
@prefix map: &lt;file:///Users/d2r/example.ttl#&gt; .

# Other namespaces
@prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; .
@prefix xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt; . 

map:Database1 a d2rq:Database;
    d2rq:jdbcDSN &quot;jdbc:mysql://localhost/iswc&quot;;
    d2rq:jdbcDriver &quot;com.mysql.jdbc.Driver&quot;;
    d2rq:username &quot;user&quot;;
    d2rq:password &quot;password&quot;;
    .
# -----------------------------------------------
# CREATE TABLE Conferences (ConfID int, Name text, Location text);

map:Conference a d2rq:ClassMap;
    d2rq:dataStorage map:Database1;
    d2rq:class :Conference;
    d2rq:uriPattern &quot;http://conferences.org/comp/confno@@Conferences.ConfID@@&quot;;
    .
map:eventTitle a d2rq:PropertyBridge;
    d2rq:belongsToClassMap map:Conference;
    d2rq:property :eventTitle;
    d2rq:column &quot;Conferences.Name&quot;;
    d2rq:datatype xsd:string;
    .
map:location a d2rq:PropertyBridge;
    d2rq:belongsToClassMap map:Conference;
    d2rq:property :location;
    d2rq:column &quot;Conferences.Location&quot;; 
    d2rq:datatype xsd:string;
    .
</pre>

<p>The individual constructs of the D2RQ mapping language are described in detail below.</p>


<h2 id="database">3. Database connection (<code>d2rq:Database</code>)</h2>

<p>A <strong><code>d2rq:Database</code></strong> defines a JDBC connection to a local or
  remote relational database.
 A D2RQ map can 
  contain several <code>d2rq:Database</code>s for accessing different databases.</p>


<h3 id="database-properties">3.1 Properties of <code>d2rq:Database</code></h3>

<table class="properties">
  <tr> 
    <th id="d2rq:jdbcDSN">d2rq:jdbcDSN</th>
    <td>The JDBC database URL. This is a string of the form
      <code>jdbc:<em>subprotocol</em>:<em>subname</em></code>. For a MySQL database,
      this is something like <code>jdbc:mysql://hostname:port/dbname</code>.
      <a href="http://www.devx.com/tips/Tip/28818">Examples for other databases</a></td>
  </tr>
  <tr> 
    <th id="d2rq:jdbcDriver">d2rq:jdbcDriver</th>
    <td>The JDBC driver class name for the database. Used together with <code>d2rq:jdbcDSN</code>.
      Example: <code>com.mysql.jdbc.Driver</code> for MySQL.</td>
  </tr>
  <tr> 
    <th id="d2rq:username">d2rq:username</th>
    <td>A username if required by the database.</td>
  </tr>
  <tr> 
    <th id="d2rq:password">d2rq:password</th>
    <td>A password if required by the database.</td>
  </tr>
  <tr> 
    <th id="d2rq:resultSizeLimit">d2rq:resultSizeLimit</th>
    <td>An integer value that will be added as a LIMIT clause to all
      generated SQL queries. This sets an upper bound for the number
      of results returned from large databases. Note that this effectively
      &#8220;cripples&#8221; the server and can cause unpredictable
      results. Also see <a href="#d2rq:limit"><code>d2rq:limit</code></a>
      and <a href="#d2rq:limitInverse"><code>d2rq:limitInverse</code></a>,
      which may be used to impose
      result limits on individual property bridges.</td>
  </tr>
  <tr> 
    <th id="d2rq:fetchSize">d2rq:fetchSize</th>
    <td>An integer value that specifies the number of rows to retrieve
       with every database request. This value is particularily important to control memory resources
       of both the D2RQ and the database server when performing dumps.
       <code>dump-rdf</code> sets this value to 500 by default, or to <code>Integer.MIN_VALUE</code> for MySQL in order to
       enable <a href="http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-implementation-notes.html">streaming mode</a>.</td>
  </tr>
  <tr>
    <th id="d2rq:startupSQLScript">d2rq:startupSQLScript</th>
    <td>URL of a SQL script to be executed on startup. Useful for initializing the connection and testing. To load from the file system relative to the mapping file's location, use this syntax: <code>d2rq:startupSQLScript &lt;file:script.sql&gt;;</code></td>
  </tr>
  <tr> 
    <th id="d2rq:textColumn">d2rq:textColumn<br />d2rq:numericColumn<br />
      d2rq:dateColumn<br />d2rq:timestampColumn<br />d2rq:timeColumn<br />
      d2rq:binaryColumn<br />d2rq:booleanColumn<br />d2rq:bitColumn<br />
      d2rq:intervalColumn</th>
    <td>These properties are used to declare the column type of database
      columns. This affects the kind of SQL literal that D2RQ will use to
      query for values in this column.
      The objects of the properties are column names in
      <code>Table_name.column_name</code> notation.
      These properties do not need to be specified <em>unless</em>
      the engine is for some reason unable to determine the correct
      column type by itself. The <code>d2rq:timestampColumn</code>
      is for column types that combine a date and a time. The
      <code>d2rq:binaryColumn</code> is for column types that contain
      binary data, such as <code>BLOB</code>s.
    </td>
  </tr>
</table>


<h3 id="example-database">3.2 Example: Connecting to a MySQL database</h3>

<pre>
map:Database1 a d2rq:Database;
    d2rq:jdbcDSN &quot;jdbc:mysql://localhost/iswc&quot;;
    d2rq:jdbcDriver &quot;com.mysql.jdbc.Driver&quot;;
    d2rq:username &quot;user&quot;;
    d2rq:password &quot;password&quot;;
    .
</pre>


<h3 id="jdbc-connection-properties">3.3 Specifying JDBC connection properties</h3>

<p>Most JDBC drivers offer a range of <em>JDBC connection properties</em>,
  which specify advanced configuration options for the JDBC database connection.
  A D2RQ mapping file can be made to use arbitrary connection properties when
  setting up the JDBC connection. This is done through the <code>jdbc:</code> namespace
  (namespace URI: <code>http://d2rq.org/terms/jdbc/</code>). RDF properties in that
  namespace will be passed as connection properties.
  Consult your JDBC driver's documentation for a list of available properties.</p>

<pre>
@prefix jdbc: &lt;http://d2rq.org/terms/jdbc/&gt; .

map:database a d2rq:Database;
    # ... other database configuration ...
    jdbc:autoReconnect "true";
    jdbc:zeroDateTimeBehavior "convertToNull";
    .
</pre>

<p>The example uses two connection properties which are understood by the MySQL
JDBC driver: <code>autoReconnect=true</code> and 
<code>zeroDateTimeBehavior=convertToNull</code>.</p>


<h3 id="keep-alive">3.4 Keep-alive long-term connections</h3>

<p>Some database servers like MySQL may terminate open client connections after some
interval (MySQL default is 8 hours). To keep alive long-term connections, D2R can be
configured to periodically run "noop" queries. This feature can be enabled with the
special property <code>jdbc:keepAlive</code>. An example is given below:</p>

<pre>@prefix jdbc: &lt;http://d2rq.org/terms/jdbc/&gt; .

map:database a d2rq:Database;
    # ... other database configuration ...
    jdbc:keepAlive "3600"; # value in seconds
    jdbc:keepAliveQuery "SELECT 1"; # (optionally to override default noop query)
    .</pre>

<p>By default the noop query is “<code>SELECT 1</code>”, which may not work with some DBMS.
For this purpose, the default query may be overridden with a custom noop query.</p>


<h2 id="configuration">4. Global configuration of the mapping engine (<code>d2rq:Configuration</code>)</h2>

<p>A <strong><code>d2rq:Configuration</code></strong> controls global behaviour of D2RQ. It is generally not required if the defaults are satisfactory.


<h3 id="configuration-properties">4.1 Properties of <code>d2rq:Configuration</code></h3>

<table class="properties">
  <tr>
    <th id="d2rq:serveVocabulary">d2rq:serveVocabulary</th>
    <td>Whether to serve inferred and user-supplied vocabulary data (boolean; <code>true</code> by default). This option is automatically set when using D2R Server's <code>--fast</code> command-line option.</td>
  </tr>
  <tr>
    <th id="d2rq:useAllOptimizations">d2rq:useAllOptimizations</th>
    <td>Whether to use bleeding edge optimizations (boolean; <code>false</code> by default).</td>
  </tr>
</table>


<h3 id="example-optimization">4.2 Example: Activating optimizations</h3>

<p>In order to activate bleeding edge optimizations, a <code>d2rq:Configuration</code> block with the property <code>d2rq:useAllOptimizations</code> set to <code>true</code> is created:</p>

<pre>
map:Configuration a d2rq:Configuration;
    d2rq:useAllOptimizations true.
</pre>


<h2 id="classmap">5. Creating RDF resources (<code>d2rq:ClassMap</code>)</h2>

<p>A <strong><code>d2rq:ClassMap</code></strong> represents a class or a group of similar classes 
  of an OWL ontology or RDFS schema. A class map defines how instances of the 
  class are identified. It is connected to a <code>d2rq:Database</code> and has
  a set of <code>d2rq:PropertyBridges</code> which attach properties to the instances.</p>


<h3 id="resource-identity">5.1 Resource Identity</h3>

<p>D2RQ provides four different mechanisms of assigning identifiers to the instances
  in the database:</p>

<dl>
<dt id="dfn-uri-pattern">URI patterns</dt>
<dd><p>A URI pattern is instantiated by inserting values of
  certain database columns into a pattern. Examples:</p>
  <pre>http://example.org/persons/@@<em>Persons.ID</em>@@
http://example.org/lineItems/item@@<em>Orders.orderID</em>@@-@@<em>LineItems.itemID</em>@@
urn:isbn:@@<em>Books.isbn</em>@@
mailto:@@<em>Persons.email</em>@@</pre>
  <p>The parts between <code>@@</code>'s mark database columns in
  <code>Table.Column</code> notation. URI patterns are used
  with the <code>d2rq:uriPattern</code> property.</p>
  <p>Certain characters, like spaces or the hash sign, are not allowed
    in URIs or have special meaning. Columns that contain such characters
    need to be encoded before their values can be inserted into a URI
    pattern:</p>
  <ul>
    <li>If a column is given as <code>@@Table.Column|<strong>urlencode</strong>@@</code>,
      then <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/net/URLEncoder.html">URL encoding</a>
      is applied before the string is inserted.</li>
    <li>If a column is given as <code>@@Table.Column|<strong>urlify</strong>@@</code>,
      then URL encoding is applied, with an additional rule that spaces are
      converted to underscores (<code>_</code>). Some people find that this
      produces friendlier URIs.</li>
    <li>If a column is given as <code>@@Table.Column|<strong>encode</strong>@@</code>,
      then <a href="http://www.w3.org/TR/rdb-direct-mapping/#defn-percent-encode">percent encoding</a>
      (as defined in W3C's <a href="http://www.w3.org/TR/rdb-direct-mapping/">Direct Mapping</a>) is applied before the string 
      is inserted.</li>
  </ul>
  <p class="warning" id="warning-column-functions"><strong>Warning:</strong> If the URIs produced by
    a URI pattern with encoding are also produced elsewhere
    in the D2RQ mapping without the use of the same encoding
    (e.g., from a
    <a href="#d2rq:uriColumn"><code>d2rq:uriColumn</code></a> or
    <a href="#d2rq:constantValue"><code>d2rq:constantValue</code></a>),
    then SPARQL queries that “join” over those URIs may not work
    as expected.</p>
</dd>

<dt id="relative-uri-patterns">Relative URI patterns</dt>
<dd><p>A relative URI pattern is a URI pattern that generates
  <em>relative URIs</em>:</p>
  <pre>persons/@@<em>Persons.ID</em>@@</pre>
  <p>They will be combined with a <em>base URI</em> provided by
  the processing environment to form full URIs. Relative
  URI patterns allow the creation of portable mappings that
  can be used for multiple instances of the same database
  schema. Relative URI patterns are generated
  with the <code>d2rq:uriPattern</code> property.</p>
</dd>

<dt id="uri-columns">URI columns</dt>
<dd><p>In some cases, the database may already contain URIs that
  can be used as resource identifiers, such as web page and
  document URLs. URI are generated from columns
  with the <code>d2rq:uriColumn</code> property.</p>
</dd>

<dt id="uri-expressions">URI expressions</dt>
<dd><p>URIs can be generated with a SQL expression, specified
   via <code>d2rq:uriSqlExpression</code>. The expression
  must yield a valid URI.</p></dd>

<dt id="blank-nodes">Blank nodes</dt>
<dd><p>RDF also has the concept of blank nodes, existential qualifiers
  that denote some resource that exists and has certain properties,
  but is not named. In D2RQ, blank nodes can be generated from one or
  more columns. A distinct blank node will be generated for each distinct
  set of values of these columns. The columns are specified using the
  with the <code>d2rq:bNodeIdColumns</code> property.</p>
<p>Note that blank nodes cannot be referenced from outside the RDF graph they
  exist in. This limits their usefulness, and they are best avoided.</p>
</dd>

<dt id="singleton-class-maps">Singleton class maps</dt>
<dd><p>A <code>d2rq:ClassMap</code> usually produces many resources. Sometimes
  it is desirable to have a class map that only produces a single resource
  with fixed, static identity. In that case, one can use the
  <code>d2rq:constantValue</code> property to provide the URI for the
  single instance.</p></dd>
</dl>


<h3 id="class-map-properties">5.2 Properties of <code>d2rq:ClassMap</code></h3>

<table class="properties">
  <tr> 
    <th id="d2rq:dataStorage">d2rq:dataStorage</th>
    <td>Reference to a <code>d2rq:Database</code> where the instance data is stored.</td>
  </tr>
  <tr> 
    <th id="d2rq:class">d2rq:class</th>
    <td>An RDF-S or OWL class. All resources generated by this
        ClassMap are instances of this class.</td>
  </tr>
  <tr> 
    <th id="d2rq:uriPattern">d2rq:uriPattern</th>
    <td>Specifies a URI pattern that will be used to
      identify instances of this class map.</td>
  </tr>
  <tr> 
    <th id="d2rq:uriColumn">d2rq:uriColumn</th>
    <td>A database column containing URIrefs for identifying
      instances of this class map. The column name has to be in the form
      <code>&quot;TableName.ColumnName&quot;</code>.</td>
  </tr>
  <tr>
    <th id="d2rq:uriSqlExpression">d2rq:uriSqlExpression</th>
    <td>A SQL expression that generates the URI identifiers
      for instances of this class map. Similar to <code>d2rq:sqlExpression</code>.
      The output must be a valid URI. Note that querying
      for such a computed value might put a heavy load on the database.
      See <a href="#example-uri-sql-expression">example</a> below.</td>
  </tr>
  <tr> 
    <th id="d2rq:bNodeIdColumns">d2rq:bNodeIdColumns</th>
    <td>A comma-seperated list of column names in
      <code>"TableName.ColumnName"</code> notation. The instances of
      this class map will be blank nodes, one distinct blank node
      per distinct tuple of these columns.</td>
  </tr>
  <tr> 
    <th id="d2rq:constantValue">d2rq:constantValue</th>
    <td>This class map will only have a single instance, which is
      named by the value of this property. This can be a blank node or a URI.</td>
  </tr>
  <tr> 
    <th id="d2rq:containsDuplicates">d2rq:containsDuplicates</th>
    <td> Must be specified if a class map uses information from tables 
      that are not fully normalized. If the <code>d2rq:containsDuplicates</code> property value 
      is set to "true", then D2RQ adds a <code>DISTINCT</code> clause to all queries using 
      this classMap. &quot;False&quot; is the default value, which doesn't have 
      to be explicitly declared. Adding this property to class maps based on normalized 
      database tables degrades query performance, but doesn't affect query results.</td>
  </tr>
  <tr>
    <th id="d2rq:additionalProperty">d2rq:additionalProperty</th>
    <td>Adds an <a href="#additionalproperty">AdditionalProperty</a>
      to all instances of this class. 
      This might be useful for adding <code>rdfs:seeAlso</code> properties or other fixed
      statements to all instances of the class. </td>
  </tr>
  <tr> 
    <th id="d2rq:condition">d2rq:condition</th>
    <td>Specifies an SQL <code>WHERE</code> condition. An instance of this class 
      will only be generated for database rows that satisfy the condition. Conditions 
      can be used to hide parts of the database from D2RQ, e.g. deny access to 
      data which is older or newer than a certain date. See section <a href="#conditional">Conditional 
      Mappings</a> for details.</td>
  </tr>
  <tr> 
    <th id="d2rq:classDefinitionLabel">d2rq:classDefinitionLabel</th>
    <td>Specifies a label that will be served as <code>rdfs:label</code>
     for all associated class definitions. Multiple lables, e.g. in several languages, are supported.</td>
  </tr>
  <tr> 
    <th id="d2rq:classDefinitionComment">d2rq:classDefinitionComment</th>
    <td>Specifies a comment that will be served as <code>rdfs:comment</code>
     for all associated class definitions. Multiple comments are supported.</td>
  </tr>
  <tr> 
    <th id="d2rq:additionalClassDefinitionProperty">d2rq:additionalClassDefinitionProperty</th>
    <td>Adds an <a href="#additionalproperty">AdditionalProperty</a>
      to all associated class definitions.</td>
  </tr>
</table>

<p>Furthermore,
<a href="#d2rq:valueMaxLength"><code>d2rq:valueMaxLength</code></a>,
<a href="#d2rq:valueRegex"><code>d2rq:valueRegex</code></a>,
<a href="#d2rq:valueContains"><code>d2rq:valueContains</code></a>,
and <a href="#d2rq:translateWith"><code>d2rq:translateWith</code></a>
can be used and work the same way as on property bridges.</p>

<p><a href="#d2rq:join"><code>d2rq:join</code></a> and
<a href="#d2rq:alias"><code>d2rq:alias</code></a> can be used too,
and are inherited by the map's property bridges.</p>


<h3 id="example-uri-pattern">5.3 Example: Identifying class map instances with a URI pattern</h3>

<pre>
map:PaperClassMap a d2rq:ClassMap;
    d2rq:uriPattern &quot;http://www.conference.org/conf02004/paper#Paper@@Papers.PaperID@@&quot;;
    d2rq:class :Paper;
    d2rq:classDefinitionLabel "paper"@en;
    d2rq:classDefinitionComment "A conference paper."@en;
    d2rq:dataStorage map:Database1;
    .
</pre>

<p>The <code>d2rq:class</code> property is used to state that all resources generated by the 
  <code>d2rq:ClassMap</code> are instances of an RDFS or OWL class. D2RQ automatically creates 
  the necessary <code>rdf:type</code> triples.</p>


<h3 id="example-blank-nodes">5.4 Example: Class map instances with blank nodes</h3>

<pre>
map:Topic a d2rq:ClassMap;
    d2rq:bNodeIdColumns &quot;Topics.TopicID&quot;;
    d2rq:class :Topic;
    d2rq:classDefinitionLabel "topic"@en;
    d2rq:classDefinitionComment "A topic."@en;
    d2rq:dataStorage map:Database1;
    .</pre>


<h3 id="example-dynamic-type">5.5 Example: A group of classes all mapped from the same table</h3>

<p>If you want to use one ClassMap for a group of classes with the same properties 
  (like Person, Professor, Researcher, Student) that all come from the same table,
  you must create the <code>rdf:type</code> statements with an object property bridge instead of
  using <code>d2rq:class</code>.</p>
<pre>
map:PersonsClassMap a d2rq:ClassMap;
    d2rq:uriColumn &quot;Persons.URI&quot;;
    d2rq:dataStorage map:Database1;
    .
map:PersonsType a d2rq:PropertyBridge;
    d2rq:property rdf:type;
    d2rq:pattern &quot;http://annotation.semanticweb.org/iswc/iswc.daml#@@Persons.Type@@&quot;; 
    d2rq:belongsToClassMap map:PersonsClassMap
    .
</pre>

<p>Here, the class of each person is obtained by prefixing the values of the Persons.Type 
  column with an ontology namespace. If the class names within the ontology can't 
  be constructed directly from values of the Persons.Type column, then a <a href="#translationtable">TranslationTable</a> 
  could be used for aligning class names and database values.</p>
  

<h2 id="propertybridge">6. Adding properties to resources (<code>d2rq:PropertyBridge</code>)</h2>

<p>A <strong><code>d2rq:PropertyBridge</code></strong> relates a database column to
  an RDF property. Property bridges are 
  used to attach properties to the RDF resources created by a class map.
  The values of these properties are often literals, but can also be URIs
  or blank nodes that relate the resource to other resources, e.g. the value
  of a paper's <code>:author</code> property could be a URI representing a person.</p>

<p>If the one of the columns used in a property bridge is <code>NULL</code>
  for some database rows, then no property is created for the resources
  corresponding to these rows.</p>


<h3 id="property-bridge-properties">6.1 Properties of <code>d2rq:PropertyBridge</code></h3>

<table class="properties">
  <tr>
    <th id="d2rq:belongsToClassMap">d2rq:belongsToClassMap</th>
    <td>Specifies that the property bridge belongs to a <code>d2rq:ClassMap</code>.
      Must be specified for every property bridge.</td>
  </tr>
  <tr>
    <th id="d2rq:property">d2rq:property</th>
    <td>The RDF property that connects the ClassMap
      with the object or literal created by the bridge. Must be specified for
      every property bridge. If multiple <code>d2rq:properties</code> are
      specified, then one triple with each property is generated per resource.</td>
  </tr>
  <tr>
    <th id="d2rq:dynamicProperty">d2rq:dynamicProperty</th>
    <td>A URI pattern that is used to generate the property URI at runtime. If multiple <code>d2rq:dynamicProperty</code> are specified, then one triple with each property is generated per resource.</td>
  </tr>
  <tr>
    <th id="d2rq:column">d2rq:column</th>
    <td>For properties with literal values.
      The database column that contains the literal values.
      Column names have to be given in the form <code>&quot;TableName.ColumnName&quot;</code>. 
    </td>
  </tr>
  <tr>
    <th id="d2rq:pattern">d2rq:pattern</th>
    <td>For properties with literal values.
      Can be used to extend and combine column values before
      they are used as a literal property value. If 
      a pattern contains more than one column, then a separating string, which 
      cannot occur in the column values, has to be used between the column names, 
      in order to allow D2RQ reversing given literals into column values.</td>
  </tr>
  <tr>
    <th id="d2rq:sqlExpression">d2rq:sqlExpression</th>
    <td>For properties with literal values. Generates
      literal values by evaluating a SQL expression. Note that querying
      for such a computed value might put a heavy load on the database.
      See <a href="#example-sqlexpression">example</a> below.</td>
  </tr>
  <tr>
    <th id="d2rq:datatype">d2rq:datatype</th>
    <td>For properties with literal values. Specifies the RDF datatype of the literals.</td>
  </tr>
  <tr>
    <th id="d2rq:lang">d2rq:lang</th>
    <td>For properties with literal values. Specifies the language tag of the literals.</td>
  </tr>
  <tr>
    <th>d2rq:constantValue</th>
    <td>For properties that have the same constant value on all
      instances of the class map. The value can be a literal, blank node, or
      URI. See <a href="#example-constant">example</a> below.</td>
  </tr>
  <tr> 
    <th id="d2rq:refersToClassMap">d2rq:refersToClassMap</th>
    <td>For properties that correspond to a foreign key.
      References another
      <code>d2rq:ClassMap</code> that creates the instances which are used
      as the values of this bridge. If these instances
      come from another table, then one or more
      <code>d2rq:join</code> properties
      must be specified to select the correct instances. See
      <a href="#example-refers">example</a> below.</td>
  </tr>
  <tr> 
    <th>d2rq:uriColumn<br />d2rq:uriPattern<br />d2rq:uriSqlExpression</th>
    <td>For properties where the value is supposed to be a URI instead
      of a literal. They work the same as on <a href="#classmap">class maps</a>.</td>
  </tr>
  <tr>
    <th id="d2rq:join">d2rq:join</th>
    <td>If the columns used to create the literal value or object
      are not from the database table(s) that contains the ClassMap's columns,
      then the tables have to be joined together using one or more <code>d2rq:join</code>
      properties.
      See <a href="#example-join">examples</a> below.</td>
  </tr>
  <tr>
    <th id="d2rq:alias">d2rq:alias</th>
    <td>Aliases take the form <code>"Table AS Alias"</code>
      and are used when a table needs to be joined to itself.
      The table can be referred to using the alias within the
      property bridge. See <a href="#example-alias">example</a> below.</td>
  </tr>
  <tr> 
    <th>d2rq:condition</th>
    <td>Specifies an SQL <code>WHERE</code> condition. The bridge will only generate 
      a statement if the condition holds. A common usage is to suppress triples 
      with empty literal values: <code>d2rq:condition &quot;Table.Column &lt;> ''&quot;</code>. 
      See section <a href="#conditional">Conditional Mappings</a> for details. 
    </td>
  </tr>
  <tr> 
    <th id="d2rq:translateWith">d2rq:translateWith</th>
    <td>Assigns a <code>d2rq:TranslationTable</code> to the property bridge. Values 
      from the <code>d2rq:column</code> or <code>d2rq:pattern</code> will be translated by the table. See 
      section <a href="#translationtable">TranslationTables</a> for details.</td>
  </tr>
  <tr> 
    <th id="d2rq:valueMaxLength">d2rq:valueMaxLength</th>
    <td>Asserts that all values of this bridge are not longer than 
      a number of characters. This allows D2RQ to speed up queries. See section 
      <a href="#hint">Performance Optimization</a> for details.</td>
  </tr>
  <tr> 
    <th id="d2rq:valueContains">d2rq:valueContains</th>
    <td>Asserts that all values of this bridge always contain a given 
      string. This allows D2RQ to speed up queries. Most useful in conjunction 
      with <code>d2rq:column.</code> See section <a href="#hint">Performance Optimization</a> 
      for details.</td>
  </tr>
  <tr> 
    <th id="d2rq:valueRegex">d2rq:valueRegex</th>
    <td>Asserts that all values of this bridge match a given <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/util/regex/Pattern.html">regular 
      expression</a>. This allows D2RQ to speed up queries. Most useful in conjunction 
      with <code>d2rq:column</code> on columns whose values are very different from other columns 
      in the database. See section <a href="#hint">Performance Optimization</a> 
      for details.</td>
  </tr>
  <tr> 
    <th id="d2rq:propertyDefinitionLabel">d2rq:propertyDefinitionLabel</th>
    <td>Specifies a label that will be served as <code>rdfs:label</code>
     for all associated property definitions. Multiple lables, e.g. in several languages, are supported.</td>
  </tr>
  <tr> 
    <th id="d2rq:propertyDefinitionComment">d2rq:propertyDefinitionComment</th>
    <td>Specifies a comment that will be served as <code>rdfs:comment</code>
     for all associated property definitions. Multiple comments are supported.</td>
  </tr>
  <tr> 
    <th id="d2rq:additionalPropertyDefinitionProperty">d2rq:additionalPropertyDefinitionProperty</th>
    <td>Adds an <a href="#additionalproperty">AdditionalProperty</a>
      to all associated property definitions.</td>
  </tr>
  <tr> 
    <th id="d2rq:limit">d2rq:limit</th>
    <td>The maximum number of results to retrieve from the database for this PropertyBridge. Also see <a href="#d2rq:resultSizeLimit"><code>d2rq:resultSizeLimit</code></a>.</td>
  </tr>
  <tr> 
    <th id="d2rq:limitInverse">d2rq:limitInverse</th>
    <td>The maximum number of results to retrieve from the database for the inverse statements for this PropertyBridge.</td>
  </tr>
  <tr> 
    <th id="d2rq:orderAsc">d2rq:orderAsc</th>
    <td>The column after which to sort results in ascending order for this PropertyBridge. Useful when results are limited using <a href="#d2rq:limit"><code>d2rq:limit</code></a>.</td>
  </tr>
  <tr> 
    <th id="d2rq:orderDesc">d2rq:orderDesc</th>
    <td>The column after which to sort results in descending order for this PropertyBridge. Useful when results are limited using <a href="#d2rq:limit"><code>d2rq:limit</code></a>.</td>
  </tr>
</table>


<h3 id="example-property-bridge">6.2 Example: A simple property bridge</h3>

<pre>
map:PaperTitle a d2rq:PropertyBridge;
    d2rq:belongsToClassMap map:Paper;
    d2rq:property :title;
    d2rq:column &quot;Papers.Title&quot;;
    d2rq:lang "en";
    d2rq:propertyDefinitionLabel "title"@en;
    d2rq:propertyDefinitionComment "A paper's title."@en;
    .
</pre>

<p>This attaches a <code>:title</code> property to all resources generated
  by the <code>map:Paper</code> class map. The property values are
  taken from the <code>Papers.Title</code> column. The generated literals
  will have a language tag of "en".</p>


<h3 id="example-join">6.3 Example: Property bridge using information from another table</h3>

<pre>
map:authorName a d2rq:PropertyBridge;
    d2rq:belongsToClassMap map:Papers;
    d2rq:property :authorName;
    d2rq:column &quot;Persons.Name&quot;;
    d2rq:join &quot;Papers.PaperID &lt;= Rel_Person_Paper.PaperID&quot;;
    d2rq:join &quot;Rel_Person_Paper.PersonID => Persons.PerID&quot;;
    d2rq:datatype xsd:string;
    d2rq:propertyDefinitionLabel "name"@en;
    d2rq:propertyDefinitionComment "Name of an author."@en;
    .
</pre>

<p>This property bridge adds the names of authors to papers. 
  If a paper has several authors, then several <code>:authorName</code>
  properties are added. The tables <code>Papers</code>
  and <code>Persons</code> are in an n:m relation. The <code>d2rq:join</code>
  is used to join the tables over the <code>Rel_Person_Paper</code>. The join condition contains
  directed arrows that indicate the foreign key relationship and are used as an optimization hint.
  In the example above, the arrow directions indicate that all possible values of <code>Rel_Person_Paper.PaperID</code> and
  <code>Rel_Person_Paper.PersonID</code> are present in <code>Papers.PaperID</code> and <code>Persons.PerID</code>, respectively.
  Where this is unclear, a simple equation sign (<code>=</code>) may be used.
  </p>


<h3 id="example-mailto">6.4 Example: A property bridge with <code>mailto:</code> URIs</h3>

<pre>
map:PersonsClassEmail a d2rq:PropertyBridge;
    d2rq:belongsToClassMap map:PersonsClassMap;
    d2rq:property :email;
    d2rq:uriPattern &quot;mailto:@@Persons.Email@@&quot;;
    .
</pre>

<p>The pattern <code>mailto:@@Persons.Email@@</code> is used to
  attach a <code>mailto:</code> prefix to the values of the
  &quot;Persons.Email&quot; column. The example uses
  <code>d2rq:uriPattern</code> instead of <code>d2rq:pattern</code>
  because the bridge should produce URIs, not literals.</p>


<h3 id="example-sqlexpression">6.5 Example: A property bridge that computes mailbox hashes</h3>

<p>The popular <a href="http://xmlns.com/foaf/0.1/">FOAF vocabulary</a> has a
  property <code>foaf:mbox_sha1sum</code> for publishing email addresses in an
  encoded form. This prevents spammers from harvesting the address, while still
  letting us recognize if the same email address is used in two different
  places.</p>
<pre>map:UserEmailSHA1 a d2rq:PropertyBridge;
    d2rq:belongsToClassMap map:User;
    d2rq:property foaf:mbox_sha1sum;
    d2rq:sqlExpression "SHA1(CONCAT('mailto:', user.email))";
    .</pre>
<p>The values of the <code>foaf:mbox_sha1sum</code> are computed by evaluating
  the <code>d2rq:sqlExpression</code>. We first create a <code>mailto:</code> URI
  from the email address, as required by FOAF. Then we apply the SHA1
  hash function, again as required by FOAF. The result will be a literal value.</p>
<p>Note that querying for a specific <code>foaf:mbox_sha1sum</code> value will
  put a heavy load on the database because the hash has to be computed for every
  user in the database. For a large database, it would be better to store the
  encoded values in a column in the database.</p>


<h3 id="example-uri-sql-expression">6.6 Example: A property bridge with URIs generated by an SQL expression</h3>

<pre>
map:HomepageURL a d2rq:PropertyBridge;
    d2rq:belongsToClassMap map:PersonsClassMap;
    d2rq:property foaf:homepage;
    d2rq:uriSqlExpression &quot;CONCAT('http://www.company.com/homepages/', user.username)&quot;;
    .
</pre>

<p>The pattern <code>mailto:@@Persons.Email@@</code> is used to
  attach a <code>mailto:</code> prefix to the values of the
  &quot;Persons.Email&quot; column. The example uses
  <code>d2rq:uriPattern</code> instead of <code>d2rq:pattern</code>
  because the bridge should produce URIs, not literals.</p>


<h3 id="example-refers">6.7 Example: Linking instances from two database tables</h3>

<pre>
map:PaperConference a d2rq:PropertyBridge;
    d2rq:belongsToClassMap map:Paper;
    d2rq:property :conference;
    d2rq:refersToClassMap map:Conference;
    d2rq:join &quot;Papers.Conference => Conferences.ConfID&quot;;
    .
</pre>

<p>The example attaches a <code>:conference</code> property to papers.
  The values of the property are generated by the <code>map:Conference</code>
  class map, not shown here. It may use a <code>d2rq:uriPattern</code>,
  <code>d2rq:uriColumn</code> or blank nodes to identify the conferences.
  The appropriate instance is found using the <code>d2rq:join</code>
  on the foreign key <code>Papers.Conference</code>.</p>


<h3 id="example-multicolumn-fk">6.8 Example: Foreign key with multiple columns</h3>

<p>Foreign keys can span multiple columns. To create a property that
links instances along such a foreign key, use multiple
<code>d2rq:join</code> properties on the property bridge, one for
each pair of columns in the key:</p>

<pre>
map:PaperConference a d2rq:PropertyBridge;
    d2rq:belongsToClassMap map:Paper;
    d2rq:property :journalIssue;
    d2rq:refersToClassMap map:JournalIssue;
    d2rq:join &quot;Papers.Journal => Journal.JournalID&quot;;
    d2rq:join &quot;Papers.Issue => Journal.IssueID&quot;;
    .
</pre>

<p>In the example, the <code>Journal</code> table has a composite
key consisting of <code>JournalID</code> and <code>IssueID</code>.
The foreign key constraint that assigns papers to journals covers
two columns, and hence two <code>d2rq:join</code>s are needed.</p>


<h3 id="example-alias">6.9 Example: Joining a table to itself using <code>d2rq:alias</code></h3>

<pre>
map:ParentTopic a d2rq:PropertyBridge;
    d2rq:belongsToClassMap map:Topic;
    d2rq:property :parentTopic;
    d2rq:refersToClassMap map:Topic;
    d2rq:join "Topics.ParentID => ParentTopics.ID";
    d2rq:alias "Topics AS ParentTopics";
    .
</pre>

<p>Here, a topic may have a parent topic whose ID is found in
  the <code>Topics.ParentID</code> column. This foreign key refers
  back to the <code>Topics.ID</code> column. The table has to be
  joined to itself. A <code>d2rq:alias</code> is declared, and
  the join is established between the original table and the
  aliased table. This pattern is typical for hierarchical
  or graph-style relationships.</p>


<h3 id="example-constant">6.10 Example: Adding a constant property-value pair to each instance of a class map</h3>

<p>Sometimes it is desirable to add a property with a constant value
  to every resource that is created by a class map. To achieve this,
  use a <code>d2rq:PropertyBridge</code> that uses <code>d2rq:constantValue</code>:</p>

<pre>
map:PersonsClassMap a d2rq:ClassMap;
    d2rq:class :Person;
    .
map:seeAlsoBridge a d2rq:PropertyBridge;
    d2rq:belongsToClassMap map:PersonsClassMap;
    d2rq:property rdfs:seeAlso;
    d2rq:constantValue &lt;http://annotation.semanticweb.org/iswc2003/>;
    .
</pre>

<p>This adds an <code>rdfs:seeAlso</code> statement with a fixed URL object
  to every instance of the <code>map:PersonsClassMap</code> class map.</p>


<h2 id="translationtable">7. Translating values (<code>d2rq:TranslationTable</code>)</h2>

<p>A <strong><code>d2rq:TranslationTable</code></strong> is an additional layer between the 
  database and the RDF world. It translates back and forth between values taken 
  from the database and RDF URIs or literals. A translation table can be attached 
  to a class map or a property bridge using the <code>d2rq:translateWith</code> property. Translation tables 
  can be used only for mappings that are unique in both directions (1:1).</p>

<p class="warning" id="warning-translation-table"><strong>Warning:</strong>
  If URIs produced using a translation table are also produced elsewhere
  in the D2RQ mapping without the same translation table (e.g., from a
  <a href="#d2rq:uriColumn"><code>d2rq:uriColumn</code></a> or
  <a href="#d2rq:constantValue"><code>d2rq:constantValue</code></a>),
  then SPARQL queries that “join” over those URIs may not work
  as expected.</p>

<h3 id="translation-table-properties">7.1 Properties of <code>d2rq:TranslationTable</code></h3>

<table class="properties">
  <tr> 
    <th id="d2rq:translation">d2rq:translation</th>
    <td>Adds a <a href="#translation"><code>d2rq:Translation</code></a>
      to the table.</td>
  </tr>
  <tr> 
    <th id="d2rq:href">d2rq:href</th>
    <td>Links to a CSV file containing translations. Each line of
      the file is a translation and contains two strings separated by a comma.
      The first one is the DB value, the second the RDF value.</td>
  </tr>
  <tr> 
    <th id="d2rq:javaClass">d2rq:javaClass</th>
    <td>The qualified name of a Java class that performs the mapping. 
      The class must implement the <a href="javadoc/de/fuberlin/wiwiss/d2rq/Translator.html">Translator</a> 
      interface. Custom Translators might be useful for encoding and decoding 
      values, but are limited to 1:1 translations. Further datails can be found 
      in the D2RQ javadocs.</td>
  </tr>
</table>


<h3 id="translation">7.2 Translation</h3>

<p>A <strong><code>d2rq:Translation</code></strong> is a single entry in a
  <code>d2rq:TranslationTable</code>.
  
<table class="properties">
  <tr> 
    <th id="d2rq:databaseValue">d2rq:databaseValue</th>
    <td>A value that might appear in a database column
      or might be generated by a <code>d2rq:pattern</code>.</td>
  </tr>
  <tr> 
    <th id="d2rq:rdfValue">d2rq:rdfValue</th>
    <td>A translation of that value to be used in RDF constructs.</td>
  </tr>
</table>


<h3 id="example-translation">7.3 Example: Translating color codes</h3>

<p>A typical application are database columns containing type codes or similar 
  enumerated values. A translation table can be used to turn them into RDF resources. 
  In this example, the column ShinyObject.Color contains a color code: "R" for 
  red, "G" for green etc. These codes must be translated into RDF resources: <code>:red</code>, 
  <code>:green</code> etc.</p>

<pre>
:red a :Color;
:green a :Color;
# ... more colors omitted ...
:blue a :Color;

map:ColorBridge a d2rq:PropertyBridge;
    d2rq:belongsToClassMap map:ShinyObjectMap;
    d2rq:property :color;
    d2rq:uriColumn "ShinyObject.Color";
    d2rq:translateWith map:ColorTable;
    .
map:ColorTable a d2rq:TranslationTable;
    d2rq:translation [ d2rq:databaseValue "R"; d2rq:rdfValue :red; ];
    d2rq:translation [ d2rq:databaseValue "G"; d2rq:rdfValue :green; ];
    # ... more translations omitted ...
    d2rq:translation [ d2rq:databaseValue "B"; d2rq:rdfValue :blue; ];
    .
</pre>

<p>The <code>d2rq:translateWith</code> statement tells D2RQ to look up database values in the 
  <code>map:ColorTable</code>. There, a translation must be given for each possible value. 
  If the database contains values which are not in the translation table, D2RQ 
  will not generate a <code>:color</code> statement for that <code>:ShinyObject</code> instance.</p>
<p>Note that the type of the resulting RDF node is determined by the bridge 
  and not by the node type of the rdfValues. <code>map:ColorBridge</code> uses <code>d2rq:uriColumn</code>.
  Thus, the translation will create URI nodes. If it used <code>d2rq:column</code>,
  then literals would be created.</p>


<h2 id="download-map">8. Enabling HTTP access to CLOBs/BLOBs (<code>d2rq:DownloadMap</code>)</h2>

<p>Some databases contain entire files, such as PDFs or PNGs, in database
columns (often of types like <code>BLOB</code>). D2R Server can make the
contents of such columns downloadable using a
<strong><code>d2rq:DownloadMap</code></strong>.</p>

<p>A <code>d2rq:DownloadMap</code> specifies the name of the column that
contains the downloadable content, and a
<a href="#dfn-uri-pattern">URI pattern</a> in the server's URI space
from where the content is to be made downloadable. An instance of
<code>d2rq:DownloadMap</code> can have the following properties:</p>


<h3 id="download-map-properties">8.1 Properties of <code>d2rq:DownloadMap</code></h3>

<table class="properties">
  <tr>
    <th>d2rq:dataStorage</th>
    <td>A <a href="#database"><code>d2rq:Database</code></a> instance</td>
  </tr>
  <tr>
    <th id="d2rq:contentDownloadColumn">d2rq:contentDownloadColumn</th>
    <td>The column containing downloadable resources, in
    <code>[SCHEMA.]TABLE.COLUMN</code> notation</td>
  </tr>
  <tr>
    <th>d2rq:uriPattern<br />d2rq:uriColumn<br />d2rq:uriSqlExpression<br />d2rq:constantValue</th>
    <td>Specifies the URIs where the server will make downloadable URIs
    available. Details are the same as for
    <a href="#classmap"><code>d2rq:ClassMap</code></a>
    and <a href="#propertybridge"><code>d2rq:PropertyBridge</code></a>.
    Only one may be used.</td>
  </tr>
  <tr>
    <th id="d2rq:mediaType">d2rq:mediaType</th>
    <td>The <a href="http://en.wikipedia.org/wiki/Internet_media_type">Internet media type</a>
      of the files served from this download map. This will be sent in the HTTP
      <code>Content-Type</code> header. Examples include <code>application/pdf</code>,
      <code>image/png</code>, <code>text/plain</code> and <code>text/html</code>.
      If absent, <code>application/octet-stream</code> will be sent to indicate
      a generic binary file. The value can be obtained from the database using
      the <a href="#d2rq:pattern"><code>d2rq:pattern</code></a> syntax (see
      <a href="#example-dynamic-mediatype">example</a>).</td>
  </tr>
  <tr>
    <th>d2rq:condition<br />d2rq:join<br />d2rq:alias</th>
    <td>Same meaning as on <a href="#classmap"><code>d2rq:ClassMap</code></a>
    and <a href="#propertybridge"><code>d2rq:PropertyBridge</code></a></td>
  </tr>
  <tr>
    <th>d2rq:belongsToClassMap</th>
    <td>Can be used instead of <code>d2rq:dataStorage</code> to point to an existing
    <a href="#classmap"><code>d2rq:ClassMap</code></a> instance. The class map's
    data storage will be used, and any conditions, joins and aliases of the
    class map will be inherited by the download map. This facilitates the use
    of a single resource as both download map and
    <a href="#propertybridge">property bridge</a>,
    see <a href="#example-combined-download-map">example</a>.</td>
  </tr>
</table>


<h3 id="example-download-map">8.2 Example: Making PDFs downloadable</h3>

<p>In the following example, the <code>PAPER.PDF</code> column is
assumed to contain PDF files.</p>

<pre>
map:PaperDownload a d2rq:DownloadMap;
    d2rq:dataStorage map:database;
    d2rq:uriPattern "downloads/@@PAPER.ID@@.pdf";
    d2rq:contentDownloadColumn "PAPER.PDF";
    d2rq:mediaType "application/pdf";
    .
</pre>

<p>This download maps makes the PDFs downloadable at URIs such as
<code>http://serverbase/papers/123/download</code>, and serves
them with the correct media type <code>application/pdf</code>.</p>


<h3 id="example-combined-download-map">8.3 Example: Download map combined with a property bridge</h3>

<p>Sometimes the URI where content can be downloaded should also be
the value of a property of some resource. To make such mappings easy,
a single resource can be declared as both a
<code>d2rq:DownloadMap</code> and <code>d2rq:PropertyBridge</code>.
The download map will inherit the class map's data storage,
as well as any conditions, aliases and joins.</p>

<pre>
map:PaperDownload a d2rq:DownloadMap, d2rq:PropertyBridge;
    d2rq:belongsToClassMap map:Paper;
    d2rq:uriPattern "downloads/@@PAPER.ID@@.pdf";
    d2rq:contentDownloadColumn "PAPER.PDF";
    d2rq:mediaType "application/pdf";
    d2rq:property ex:download;
    d2rq:condition "PAPER.PDF IS NOT NULL";
    .
</pre>

<p>This makes the contents of the <code>PAPER.PDF</code> column
downloadable at URIs like <code>http://serverbase/papers/123/download</code>,
and at the same time adds these URIs as values of the
<code>ex:download</code> properties to the instances generated
by the <code>map:Paper</code> class map.</p>

<p>Also note the <code>d2rq:condition</code>, which suppresses creation of
the <code>ex:download</code> triple if the value of <code>PAPER.PDF</code>
is <code>NULL</code>.</p>


<h3 id="example-multiple-download-formats">8.4 Example: Downloads in multiple formats</h3>

<p>Sometimes, the files in a download column are not in a single
format, but in multiple formats, with the format indicated in 
an additional column. This can be handled by defining multiple
download maps with appropriate <code>d2rq:condition</code>s.</p>

<pre>
map:PaperDownloadPDF a d2rq:DownloadMap;
    d2rq:dataStorage map:database;
    d2rq:uriPattern "downloads/@@PAPER.ID@@.pdf";
    d2rq:contentDownloadColumn "PAPER.DOWNLOAD";
    d2rq:mediaType "application/pdf";
    d2rq:condition "PAPER.FORMAT = 'PDF'";
    .
map:PaperDownloadWord a d2rq:DownloadMap;
    d2rq:dataStorage map:database;
    d2rq:uriPattern "downloads/@@PAPER.ID@@.doc";
    d2rq:contentDownloadColumn "PAPER.DOWNLOAD";
    d2rq:mediaType "application/msword";
    d2rq:condition "PAPER.FORMAT = 'DOC'";
    .
</pre>


<h3 id="example-dynamic-mediatype">8.5 Example: Media type from a database column</h3>

<p>The <code>d2rq:mediaType</code> of a download map can be a
pattern that is instantiated with column values:</p>

<pre>
map:PaperDownloadPDF a d2rq:DownloadMap;
    d2rq:dataStorage map:database;
    d2rq:uriPattern "downloads/@@PAPER.ID@@";
    d2rq:contentDownloadColumn "PAPER.DOWNLOAD";
    d2rq:mediaType "@@PAPER.MIMETYPE@@";
    .
</pre>


<h2 id="servingvocabularies">9. Serving Vocabulary Classes and Properties</h2>

<p>In the spirit of <a href="http://en.wikipedia.org/wiki/Linked_Data">Linked Data</a>, the URIs of classes and properties should be dereferenceable.</p>

<p>In a mapping file auto-generated by the <a href="generate-mapping"><code>generate-mapping</code> utility</a>, the classes and properties have QNames such as <code>vocab:TableName</code> and <code>vocab:TableName_ColumnName</code>. The <code>vocab:</code> prefix expands to a URI relative to the base URI of the server, yielding URIs such as <code>http://<em>baseURI</em>/vocab/TableName</code>. These URIs can be dereferenced in D2R Server.</p>

<p>By default, the only statement about these URIs is an <code>rdf:type</code> statement that declares the URI as an <code>rdfs:Class</code> or <code>rdf:Property</code>. However, further statements can be added in the mapping file. This is done by adding additional properties, described in this section, to the class map or property map. The following mapping illustrates the intended usage:</p>

<pre>@prefix vocabClass: &lt;http://localhost:2020/vocab/resource/class/&gt; .
@prefix vocabProperty: &lt;http://localhost:2020/vocab/resource/property/&gt; .

map:offer a d2rq:ClassMap;
    d2rq:classDefinitionLabel "Offer"@en;
    d2rq:classDefinitionComment "This is an offer"@en;
    d2rq:class vocabClass:Offer;
    .
</pre>

<p>When dereferenced, <code>http://localhost:2020/vocab/resource/class/Offer</code> will return the specified label and comment as well as the automatically inferred type <code>rdfs:Class</code>. Note that the prefixes are bound to absolute URIs because relative URIs would be based under <code>http://localhost:2020/resource/</code>.</p>

<p>This feature only works for simple (URI, ANY, ANY) or (ANY, ANY, URI) find patterns that touch on vocabulary resources. In other words, it only works when dereferencing the class or property URI, or when describing the URI using a a SPARQL <code>DESCRIBE</code> query. It currently does <em>not</em> work within other SPARQL queries such as <code>SELECT</code> or <code>CONSTRUCT</code>.</p> 


<h3 id="vocab-label-comment">9.1 Labels and Comments for Vocabulary Terms</h3>

<p>An <code>rdfs:label</code> can be added to a term URI by ading <code>d2rq:classDefinitionLabel</code> or <code>d2rq:propertyDefinitionLabel</code> to the class map or property map.</p>

<p>An <code>rdfs:comment</code> can be added by adding <code>d2rq:classDefinitionComment</code> and <code>d2rq:propertyDefinitionComment</code> to the class map or property map.</p>

<p>Other properties can be added by creating a <code>d2rq:AdditionalProperty</code> construct, described below, and by linking to it from the class map or property map using <code>d2rq:additionalClassDefinitionProperty</code> and <code>d2rq:additionalPropertyDefinitionProperty</code>.</p>


<h3 id="additionalproperty">9.2 AdditionalProperty</h3>

<p>A <strong><code>d2rq:AdditionalProperty</code></strong> construct can be used to add a fixed statement 
  to all class definitions of a class map, or to all property definitions of a property bridge.
  The statement is added to the result sets, if patterns like (ANY, ANY, ANY), (URI, ANY, ANY) or (URI, additionalPropertyName, 
  ANY) are used. 
  
  The usage of <code>d2rq:AdditionalProperty</code> to add instance data is now deprecated (<a href="#additionalproperty_deprecated">details</a>).
  
  The <code>d2rq:additionalClassDefinitionProperty</code> and <code>d2rq:additionalPropertyDefinitionProperty</code> properties are used to link from the class map
  or property bridge to the <code>d2rq:AdditionalProperty</code> definition.</p>

<table class="properties">
  <tr> 
    <th>d2rq:propertyName </th>
    <td>The RDF property to be used as the predicate
      of all fixed statements.</td>
  </tr>
  <tr> 
    <th>d2rq:propertyValue</th>
    <td>The value to be used as the object of all fixed statements.</td>
  </tr>
</table>


<h3 id="example-equivalent-class">9.3 Example: Providing an additional property for a class definition</h3>

<pre>
map:PersonsClassMap a d2rq:ClassMap;
    d2rq:class :Person;
    d2rq:additionalClassDefinitionProperty map:PersonEquivalence;
    .
map:PersonEquivalence a d2rq:AdditionalProperty;
    d2rq:propertyName owl:equivalentClass;
    d2rq:propertyValue foaf:Person;
    .
</pre>

<p>This adds an <code>owl:equivalentClass</code> statement with the fixed object <code>foaf:Person</code> to every related class definition.</p>


<h3 id="example-equivalent-property">9.4 Example: Providing an additional property for a property definition</h3>

<pre>
map:PaperTitle a d2rq:PropertyBridge;
    d2rq:belongsToClassMap map:Paper;
    d2rq:property :title;
    d2rq:column "Papers.Title";
    d2rq:additionalPropertyDefinitionProperty map:PaperTitleEquivalence;
    .
map:PaperTitleEquivalence a d2rq:AdditionalProperty;
    d2rq:propertyName owl:equivalentProperty;
    d2rq:propertyValue dc:title;
    .
</pre>

<p>This adds an <code>owl:equivalentProperty</code> statement with the fixed object <code>dc:title</code> to every related property definition.</p>


<h3 id="vocabulary-serving">9.5 Controlling vocabulary serving</h3>

<p>Vocabulary serving is enabled by default. In order to deactivate it, a <a href="#configuration"><code>d2rq:Configuration</code></a> block
with the property <code>d2rq:serveVocabulary</code> set to <code>false</code> must be created:

<pre>map:Configuration a d2rq:Configuration;
    d2rq:serveVocabulary false.</pre>


<h2 id="conditional">10. Conditional Mappings</h2>

<p>Sometimes only certain information from a database should be accessible, because 
  parts of the database might be confidential or outdated. Using <strong><code>d2rq:condition</code></strong> 
  you can specify conditions, which must be satisfied by all accessible data.</p>

<p>You can use <code>d2rq:condition</code> on class map and property bridge level. The <code>d2rq:condition</code>
  value is added as an additional SQL <code>WHERE</code> clause to all queries generated using 
  the class map or property bridge. If the condition evaluates to FALSE for a 
  SQL result set row, then no triples will be generated from that row.</p>


<h3 id="example-condition">10.1 Example: Using <code>d2rq:condition</code> on a <code>d2rq:ClassMap</code></h3>

<pre>
map:Paper a d2rq:ClassMap;
    d2rq:class :Paper;
    d2rq:uriPattern "http://www.conference.org/conf02004/paper#Paper@@Papers.PaperID@@";
    d2rq:condition "Papers.Publish = 1";
    d2rq:dataStorage map:Database1;
    .
</pre>

<p>Only those papers with a value of 1 in the Papers.Publish column will be accessible. 
  All other papers are ignored.</p>


<h3 id="example-zerolength">10.2 Example: Filtering zero-length strings</h3>

<p>Usually, the special value <code>NULL</code> is used in a database to indicate that some 
  field has no value, or that the value is unknown. Some databases, however, are 
  using a zero-length string ("") instead. D2RQ doesn't generate RDF statements 
  from <code>NULL</code> values, but it doesn't recognize zero-length strings and will generate 
  statements like <code>:Person123 :firstName "".</code> if the person's first name 
  is a zero-length string. In oder to suppress these statements, a <code>d2rq:condition</code>
  can be added to the property bridge:</p>

<pre>
map:PersonsClassFirstName a d2rq:PropertyBridge;
    d2rq:property :firstName;
    d2rq:column "Persons.FirstName";
    d2rq:belongsToClassMap map:PersonsClassMap;
    d2rq:condition "Persons.FirstName &lt;&gt; ''";
    .
</pre>


<h3 id="example-typecodes">10.3 Example: Relationship type codes</h3>

<p>Imagine a table Rel_Paper_Topic that associates rows from a Papers table
  with rows from a Topics table. The Rel_Paper_Topic table contains a
  PaperID column to reference the papers, a TopicID to reference the topics,
  and a RelationshipType column which contains 1 if the topic is a primary
  topic of the paper, and 2 if it is a secondary topic.</p>
<p>For primary topic relationships, the <code>:primaryTopic</code> property shall be used,
  and for others the <code>:secondaryTopic</code> property.</p>
<p>We can build a map for this scenario by creating two property bridges.
  One for <code>:primaryTopic,</code> one for <code>:secondaryTopic.</code> We add a <code>d2rq:condition</code>
  to both bridges to suppress those statements where the RelationshipType
  column doesn't have the correct value.</p>

<pre>
map:primaryTopic a d2rq:PropertyBridge;
    d2rq:belongsToClassMap map:Paper;
    d2rq:property :primaryTopic;
    d2rq:refersToClassMap map:Topic;
    d2rq:join "Papers.PaperID &lt;= Rel_Paper_Topic.PaperID";
    d2rq:join "Rel_Paper_Topic.TopicID => Topics.TopicID";
    d2rq:condition "Rel_Paper_Topic.RelationType = 1";
    .
map:secondaryTopic a d2rq:PropertyBridge;
    d2rq:belongsToClassMap map:Paper;
    d2rq:property :secondaryTopic;
    d2rq:refersToClassMap map:Topic;
    d2rq:join "Papers.PaperID &lt;= Rel_Paper_Topic.PaperID";
    d2rq:join "Rel_Paper_Topic.TopicID => Topics.TopicID";
    d2rq:condition "Rel_Paper_Topic.RelationType = 2";
    .
</pre>


<h2 id="hint">11. Performance Optimization using Hint Properties</h2>

<p>This section covers hint properties that can be added to property bridges in 
  order to speed up queries: <code>d2rq:valueMaxLength</code>,
  <code>d2rq:valueRegex</code> and <code>d2rq:valueContains</code>.</p>

<p>You are geting the largest performance gain by providing hints for property 
  bridges which are using <code>d2rq:column</code>. You should define hints on columns of large 
  tables and on columns that are not indexed by the database. These are the cases 
  where a well-placed optimization hint can result in an order-of-magnitude improvement 
  for some queries. Don't bother to provide hints for property bridges based on 
  <code>d2rq:pattern</code>. These can be optimized very well without hints. In general,
  the biggest payoff is expected for hints on large tables. If you have a few
  very large tables with non-indexed columns in your database, that's where you
  should focus your efforts.</p>

<p>Please keep in mind that hint properties are not intended for filtering of 
  unwanted database values. They are only performance hints. Values that do not 
  fulfill the criteria will still appear in query results if find patterns like 
  (URI, ANY, ANY) are used. In oder to filter values, use <a href="#conditional"><code>d2rq:condition</code></a> 
  or a <a href="#translationtable">translation table</a> with a custom Java class 
  that returns <code>null</code> for unwanted database values.</p>


<h3 id="example-maxlength">11.1 Example: Providing a maximum length</h3>

<pre>
map:PersonsClassFirstName a d2rq:PropertyBridge;
    d2rq:property :firstName;
    d2rq:column "Persons.FirstName";
    d2rq:belongsToClassMap map:PersonsClassMap;
    d2rq:valueMaxLength "15";
    .
</pre>

<p>The <code>d2rq:valueMaxLength</code> property can be used to tell D2RQ that the length of 
  Persons.FirstName values is limited to 15 characters. Using this information, 
  D2RQ doesn't have to look in the database anymore to figure out, that a given 
  FirstName which is longer than 15 characters isn't fitting.</p>


<h3 id="example-value-regex">11.2 Example: Providing a regular expression</h3>

<pre>
map:PaperYear a d2rq:PropertyBridge;
    d2rq:property :year;
    d2rq:column "Papers.Year";
    d2rq:belongsToClassMap map:Paper;
    d2rq:datatype xsd:gYear;
    d2rq:valueRegex "^[0-9]{4}$"
    .
</pre>

<p>Here, the <code>d2rq:valueRegex</code> property is used to provide a <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/util/regex/Pattern.html">regular 
  expression</a> for the Papers.Year column. The statement asserts that all values 
  match the regular expression (or are <code>NULL</code>). The expression <code>^[0-9]{4}$</code> 
  matches every four-digit number. If you don't want to use the full regular expression 
  machinery, you can use <code>d2rq:valueContains</code> to assert that all values generated 
  by the property bridge contain a certain phrase.</p>


<h2 id="deprecated">12. Deprecated Language Constructs</h2>

<p>This section lists several language constructs from older versions
of the D2RQ mapping language that have been replaced by better
alternatives and should no longer be used.</p>


<h3 id="datatype-object">12.1 <code>d2rq:DatatypePropertyBridge</code> and <code>d2rq:ObjectPropertyBridge</code></h3>

<p>Older versions of the language used two different classes to
distinguish between property bridges that produce literals, and
bridges that produce resources.</p>

<p>In the current version, both cases
are handled by the <code>d2rq:PropertyBridge</code> class. The distinction
is made by using an appropriate property on the bridge declaration:
<code>d2rq:column</code> and <code>d2rq:pattern</code> for literals,
<code>d2rq:uriColumn</code>, <code>d2rq:uriPattern</code> and
<code>d2rq:bNodeIdColumns</code> for resources.</p>


<h3 id="additionalproperty_deprecated">12.2 <code>d2rq:additionalProperty</code></h3>

<p>Up until D2RQ 0.5.1, the <code>d2rq:AdditionalProperty</code> construct could be used
  to add a constant property-value pairs to all instances of a class map. An example
  is shown below:</p>
<pre>map:PersonsClassMap a d2rq:ClassMap;
    d2rq:class :Person;
    d2rq:additionalProperty map:SeeAlsoStatement.

map:SeeAlsoStatement a d2rq:AdditionalProperty;
    d2rq:propertyName rdfs:seeAlso;
    d2rq:propertyValue &lt;http://annotation.semanticweb.org/iswc2003/>.</pre>

<p>This adds an <code>rdfs:seeAlso</code> statement with a fixed URL object to every instance of
  the persons class map. In recent versions of the mapping language, the same is
  achieved by adding a property bridge to the class map, and giving it a
  <code>d2rq:constantValue</code> property with the fixed URL as the object, as
  shown in <a href="#example-constant">this example</a>.
</p>
<p><code>d2rq:AdditionalProperty</code> constructs
<a href="#additionalproperty">are still used</a> with
<code>d2rq:additionalClassDefinitionProperty</code>
and <code>d2rq:additionalPropertyDefinitionProperty</code>.</p>


<h3 id="deprecated-class-map-property-bridge">12.3 <code>d2rq:classMap</code> and <code>d2rq:propertyBridge</code> properties</h3>

<table class="properties">
  <tr> 
    <th>d2rq:classMap</th>
    <td>Specifies that a <a href="#classmap"><code>d2rq:ClassMap</code></a> is used
    to create instances of a given OWL or RDFS class. Use its inverse,
    <code>d2rq:class</code>, instead.</td>
  </tr>
  <tr> 
    <th>d2rq:propertyBridge</th>
    <td>Specifies that a <a href="#propertybridge"><code>d2rq:PropertyBridge</code></a>
    is used to create triples with a given RDF property in the predicate
    position. Use its inverse, <code>d2rq:property</code>, instead.</td>
  </tr>
</table>


<h3 id="deprecated-odbc-dsn">12.4 <code>d2rq:odbcDSN</code> and <code>d2rq:allowDistinct</code></h3>

<p>These are deprecated properties of <code>d2rq:Database</code>:</p>

<table class="properties">
  <tr>
    <th id="d2rq:odbcDSN">d2rq:odbcDSN</th>
    <td>Up to D2RQ 0.7, the <code>d2rq:odbcDSN</code> property could be
used on <code>d2rq:Database</code> to connect to ODBC data sources
using Sun's ODBC-JDBC bridge. This has been deprecated since JDBC
drivers are now readily available for most if not all data sources
and generally work better. Users can still use ODBC data sources by downloading an
ODBC-JDBC bridge from a vendor and using it like any other
JDBC driver, with a <code>d2rq:jdbcDSN</code> such as
<code>jdbc:odbc:<em>mydatabase</em></code>.</td>
  </tr>
  <tr> 
    <th id="d2rq:allowDistinct">d2rq:allowDistinct</th>
    <td>In D2RQ up to v0.8, this indicated the database's ability to handle
      <code>DISTINCT</code> correctly. Value: <code>true</code> or <code>false</code>.
      For example MSAccess cuts fields longer than 256 chars. The property is no
      longer necessary, as D2RQ now determines the correct value automatically.</td>
  </tr>
</table>
  </body>
</html>
